import {defineStore} from "pinia";
import {PreferredEntity} from "../../bindings/quant/backend/entity";

export const useSubscribeStore = defineStore('subscribe', {
    state: () => (
        {
            is_subscribed: false,
            btn_type: "primary",
            btn_text: "订阅行情",
            data: [] as PreferredEntity[]
        }),
    getters: {},
    actions: {
        subscribe() {
            this.is_subscribed = true
            this.btn_type = "warning"
            this.btn_text = "停止订阅"
        },
        unsubscribe() {
            this.is_subscribed = false
            this.btn_type = "primary"
            this.btn_text = "开始订阅"
        },
    },
})